// axios封装第二层：账号管理模块，所有用户管理模块的接口全部在这里进行封装
import request from "@/utils/request.js";  //引入增强过后的axios

// 登录的接口函数
export const checkLogin = function (data) {
  return request({
    method: 'post',
    url: '/users/checkLogin',
    data,
  });
}

// 获取用户列表
export const userList = function (params) {
  return request({
    method: 'get',
    url: '/users/list',
    params,
  });
}

// 检查账号是否重复
export const userRepeat = function (data) {
  return request({
    method: "post",
    url: "/users/repeat",
    data,
  })
}

// 添加账号
export const userAdd = function (data) {
  return request({
    method: "post",
    url: "/users/add",
    data,
  })
}

// 删除账号
export const userDel = function (params) {
  return request({
    method: 'get',
    url: '/users/del',
    params,
  });
}

// 修改账号
export const userEdit = function (data) {
  return request({
    method: "post",
    url: "/users/edit",
    data,
  })
}

// 检查旧密码是否正确
export const checkOldpwd = function (params) {
  return request({
    method: 'get',
    url: '/users/checkoldpwd',
    params,
  });
}

// 修改密码
export const editPwd = function (data) {
  return request({
    method: "post",
    url: "/users/editpwd",
    data,
  })
}

// 获取账号（个人中心）信息
export const userInfo = function (params) {
  return request({
    method: 'get',
    url: '/users/info',
    params,
  });
}

// 修改用户头像
export const avataredit = function (params) {
  return request({
    method: 'get',
    url: '/users/avataredit',
    params,
  });
}

// 批量删除
export const batchdel = function (data) {
  return request({
    method: "post",
    url: "/users/batchdel",
    data,
  })
}